package com.dzsw.vt.create;

import com.dzsw.runnable.CustomRunnable;

import java.util.concurrent.ThreadFactory;

public class UseFactory {

    public static void main(String[] args) throws InterruptedException {
        ThreadFactory threadFactory = Thread.ofVirtual().factory();
        Thread thread = threadFactory.newThread(new CustomRunnable());
        thread.start();
        thread.join(3000);
        // 主线程结束后，虚拟线程内存会被释放，不会等待线程结束，所以线程最后的内容无法打印出来。
    }
}
